#!/usr/bin/perl

my $action='tally';
my $count = 100;
my $dst = "./performance_results";

my @bins = (	['xlc','./xlc/openssl'],
		['gcc','./gcc/openssl-0.9.8g/apps/openssl']
	); 

for(@ARGV) {
	$action = $1 if(/--action=(.*)/);
	$count = $1 if(/--count=(.*)/);
	$dst = $1 if(/--dst=(.*)/);
}

@speed_tests = ('ecdsap160','ecdsap192','ecdsap224',
		'ecdsak163','ecdsak233',
		'ecdsab163','ecdsab233'
		);

if($action eq 'collect') {
if (0!=system("mkdir -p $dst")) {die "Couldnt create folder \'$dst\'\n";}

for($i=0;$i<$count;$i++) {

for(@bins) {
	my ($binname,$bin) = @$_;
	for(@speed_tests) {
		my $test = $_;
		my $cmd = "$bin speed $test > $dst/speed_${test}_${binname}_$i";

		system($cmd);
	}
}

}

} elsif($action eq 'tally') {

}


